﻿using System.ServiceModel;
using MyFloridaHouse.libSTO;
using MyFloridaHouse.libSvDTO;
using System;

namespace MyFloridaHouse.MapServer
{
	// NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IDistrBldr" in both code and config file together.
	[ServiceContract]
	public interface IDistrBldr
	{
		/// <summary>
		/// Gets the census geometry 
		/// </summary>
		/// <returns>CensusGeometrySTO</returns>
		[OperationContract]
        CensusGeometrySTO StartupGetCensusGeometry(DateTime clientFileTimestamp);

        /// <summary>
        /// Gets the district plan types.
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        DistrictPlanTypeSTO StartupGetDistrictPlanTypes(DateTime clientFileTimestamp);

        /// <summary>
        /// Gets the layers.
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        LayerSTO StartupGetLayers();

		//Todo: Is this object cached in isolated storage?
		/// <summary>
		/// Gets the file. District plans (existing) are fixed and have been compressed and stored
		/// as blobs in azure storage. The <see cref="FileInfoDTO"/> blob to get from storage. The
		/// plan name to be retreived is sourced from storage using the FileInfoSTO GetFileInfo() method.
		/// Executed only once per session.
		/// </summary>
		/// <param name="fileToGet"><see cref="FileInfoDTO"/> that is the plan stored as a blob. The file (blob) to get.</param>
		/// <returns>FileSTO</returns>
		[OperationContract]
		FileSTO GetFile(FileInfoDTO fileToGet);

		/// <summary>
		/// Gets the file info. District plans are stored as blobs as named objects. This method returns
		/// a list of info object that are used to populate a user screen control. The user select a plan
		/// which is in turn passed to the FileSTO GetFile method as a parameter.
		/// Executed only once per session.
		/// </summary>
		/// <returns>FileInfoSTO</returns>
		[OperationContract]
		FileInfoSTO GetFileInfo();

		/// <summary>
		/// Gets the district shape.
		/// </summary>
		/// <param name="iCompressedShapeList">The i compressed shape list.</param>
		/// <param name="iDistrictID">The i district ID.</param>
		/// <returns></returns>
		[OperationContract]
		DistrictShapeSTO GetDistrictShape(byte[] iCompressedShapeList, int iDistrictID);

		/// <summary>
		/// Gets the shape uogIDs as a list of ShapeUogIDDTO objects
		/// </summary>
		/// <param name="iWktList">The iWKtlist.</param>
		/// <param name="iLayerID">The iLayerID.</param>
		/// <param name="iDistrictID">The iDistrictID.</param>
		/// <returns></returns>
		[OperationContract]
		ShapeUogidSTO GetShapeUogIDs(string iWktList, int iLayerID, int iDistrictID);

		/// <summary>
		/// Gets the district data summary.
		/// </summary>
		/// <param name="iDistrictID">The i district ID.</param>
		/// <param name="compressediRegionIDList">The compressedi region ID list.</param>
		/// <param name="iSourceLayerIDList">The i source layer ID list.</param>
		/// <param name="iDictionaryIDList">The i dictionary ID list.</param>
		/// <returns></returns>
		[OperationContract]
		DistrictDataSummarySTO GetDistrictDataSummary(int iDistrictID, byte[] compressediRegionIDList, string iSourceLayerIDList, string iDictionaryIDList);

		/// <summary>
		/// Gets the ACS (American Community Survey) district data summary.
		/// </summary>
		/// <param name="iDistrictID">The i district ID.</param>
		/// <param name="compressediRegionIDList">The compressedi region ID list.</param>
		/// <param name="iSourceLayerID">The i source layer ID.</param>
		/// <param name="iTableIDList">The i table ID list.</param>
		/// <returns></returns>
		[OperationContract]
		ACSDistrictSummaryReportSTO GetACSDistrictDataSummary(int iDistrictID, byte[] compressediRegionIDList, string iSourceLayerID, string iTableIDList);

		/// <summary>
		/// Gets the ACS (American Community Survey) report definition.
		/// </summary>
		/// <returns></returns>
		[OperationContract]
		ACSDistrictSummaryReportDefinitionSTO GetACSReportDefinition();

		/// <summary>
		/// Gets the region data list.
		/// </summary>
		/// <param name="layerID">The layer ID.</param>
		/// <param name="regionID">The region ID.</param>
		/// <returns></returns>
		[OperationContract]
		RegionDataListSTO GetRegionDataList(int layerID, int regionID);

		/// <summary>
		/// Gets the layer regions shapes in view.
		/// </summary>
		/// <param name="iZoomLevel">The i zoom level.</param>
		/// <param name="iLayerID">The i layer ID.</param>
		/// <param name="iNorth">The i north.</param>
		/// <param name="iEast">The i east.</param>
		/// <param name="iSouth">The i south.</param>
		/// <param name="iWest">The i west.</param>
		/// <returns></returns>
		[OperationContract]
		LayerRegionsShapesSTO GetLayerRegionsShapesInView(double iZoomLevel, int iLayerID, double iNorth, double iEast, double iSouth, double iWest);

		/// <summary>
		/// Gets the layer regions data in view.
		/// </summary>
		/// <param name="iTargetLayerID">The i target layer ID.</param>
		/// <param name="iRegionIDList">The i region ID list.</param>
		/// <param name="iSourceLayerIDList">The i source layer ID list.</param>
		/// <param name="iDictionaryIDList">The i dictionary ID list.</param>
		/// <returns></returns>
		[OperationContract]
		LayerRegionsDataSTO GetLayerRegionsDataInView(int iTargetLayerID, string iRegionIDList, string iSourceLayerIDList, string iDictionaryIDList);

		//Todo: Future methods
		#region 

		/// <summary>
		/// Obsolete
		/// Gets the data dictionary denominators.
		/// </summary>
		/// <param name="iDataPartIDList">The i data part ID list.</param>
		/// <returns></returns>
		/// <remarks>This method is never called from WCF.</remarks>
		[OperationContract]
		DataDictionaryDenominatorSTO GetDataDictionaryDenominators(string iDataPartIDList);

		/// <summary>
		/// Obsolete
		/// Gets the data dictionary parts.
		/// </summary>
		/// <returns></returns>
		/// <remarks>This method is never called from WCF.</remarks>
		[OperationContract]
		DataDictionaryPartSTO GetDataDictionaryParts();

		/// <summary>
		/// Obsolete
		/// Gets the layer data dictionary.
		/// </summary>
		/// <returns></returns>
		/// <remarks>This method is never called from WCF.</remarks>
		[OperationContract]
		DataDictionarySTO GetLayerDataDictionary();

		#endregion

	}
}